package com.sxj.corejava.code14_Lambda表达式;

import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Supplier;

public class Test07_构造方法引用 {

    public static void main(String[] args) {
        // 调用无参构造方法
        // User user = new User();
        Supplier<User> s = User::new;
        User user = s.get();
        System.out.println(user);

        // 单参数构造方法
        // User user2 = new User(1);
        Function<Integer, User> f = User::new;
        User user2 = f.apply(1);
        System.out.println(user2);

        // 两个参数的构造方法
        // User user3 = new User(1,"admin");
        BiFunction<Integer, String, User> bf = User::new;
        User user3 = bf.apply(1, "admin");
        System.out.println(user3);
    }

}
